<?php

namespace login\view;

require_once("login/model/User.php");

class UserInfo {
	private static $sessionLoggedIn = "loggedin";
	private static $postUName = "uName";
	private static $postPWord = "pWord";
	private static $newUserName = "NewUserName";
	private static $newPassword = "NewPassword";
	private static $arrayusername = "username";
	private static $arraypassword = "password";
	private static $loggedinusername = "loggedinusername";
	/**
	 * @return boolean
	 */
	public function sessionSet() {
		return isset($_SESSION[self::$sessionLoggedIn]);
	}

	/**
	 * @param string $username
	 */
	public function setUserLoggedinCookie($username) {
		setcookie(self::$loggedinusername, $username);
	}

	public function removeUserLoggedInCookie() {
		setcookie(self::$loggedinusername, 0, time()-3600);
	}
	/**
	 * @return boolean
	 */
	public function getUserLoggedinInfo() {
		return $_COOKIE[self::$loggedinusername];
	}
	/**
	 * @return \login\model\User
	 */
	public function getUserInfo() {
		return new \login\model\User($_POST[self::$postUName],
									 $_POST[self::$postPWord]);
	}
	/**
	 * @return \login\model\User
	 */
	public function getNewUserInfo() {
		return new \login\model\User($_POST[self::$newUserName],
									 $_POST[self::$newPassword]);
	}
}